<?php
//scope=snsapi_userinfo实例
//个人测试号
$appid = 'wxd17a3baf67b5eb59';
$secret = '53493ffae58f62fe215cc3925ccb57eb';
//xb测试号
// $appid = 'wx5788137027e155d5';
// $appsecret = '6a3a12f21af7e6770169e2cdb511f482';
$rurl = urlencode('http://wx.alisleepy.top/userinfo/getuserinfo.php');

$url ="https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$rurl&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
header("Location:".$url);